import Main from '@/components/main'
import parentView from '@/components/parent-view'

/**
 * iview-admin中meta除了原生参数外可配置的参数:
 * meta: {
 * keepAlive: true,
 *  title: { String|Number|Function }
 *         显示在侧边栏、面包屑和标签栏的文字
 *         使用'{{ 多语言字段 }}'形式结合多语言使用，例子看多语言的路由配置;
 *         可以传入一个回调函数，参数是当前路由对象，例子看动态路由和带参路由
 *  hideInBread: (false) 设为true后此级路由将不会出现在面包屑中，示例看QQ群路由配置
 *  hideInMenu: (false) 设为true后在左侧菜单不会显示该页面选项
 *  notCache: (false) 设为true后页面在切换标签后不会缓存，如果需要缓存，无需设置这个字段，而且需要设置页面组件name属性和路由配置的name一致
 *  access: (null) 可访问该页面的权限数组，当前路由设置的权限会影响子路由
 *  icon: (-) 该页面在左侧菜单、面包屑和标签导航处显示的图标，如果是自定义图标，需要在图标名称前加下划线'_'
 *  beforeCloseName: (-) 设置该字段，则在关闭当前tab页时会去'@/router/before-close.js'里寻找该字段名对应的方法，作为关闭前的钩子函数
 * }
 */

import mailManageRouter from './modules/mail-manage.js'

export default [
  // reportManageRouter,// 报表管理
  {
    path: '/login',
    name: 'login',
    meta: {
      keepAlive: true,
      title: 'Login - 登录',
      hideInMenu: true
    },
    component: () => import('@/view/login/login.vue')
  },
  {
    path: '/third_party_login',
    name: 'third_party_login',
    meta: {
      keepAlive: true,
      title: 'Login - 登录',
      hideInMenu: true
    },
    component: () => import('@/view/login/third_party_login.vue')
  },
  {
    path: '/revise',
    name: 'revise',
    component: Main,
    meta: {
      keepAlive: true,
      hideInBread: true,
      hideInMenu: true
      // notCache: false
    },
    children: [
      {
        path: 'password',
        name: 'password',
        meta: {
          keepAlive: true,
          title: '修改密码',
          // notCache: false,
          icon: ''
        },
        component: () => import('@/view/login/revisepw.vue')
      }
    ]
  },
  {
    path: '/logger',
    name: 'logger',
    component: Main,
    meta: {
      keepAlive: true,
      hideInBread: true,
      hideInMenu: true
      // notCache: false
    },
    children: [
      {
        path: 'loggerList',
        name: 'loggerList',
        meta: {
          keepAlive: true,
          title: '操作日志',
          // notCache: false,
          icon: ''
        },
        component: () => import('@/view/home/logger.vue')
      }
    ]
  },
  {
    path: '/logger',
    name: 'logger',
    component: Main,
    meta: {
      keepAlive: true,
      hideInBread: true,
      hideInMenu: true
      // notCache: false
    },
    children: [
      {
        path: 'loggerList',
        name: 'loggerList',
        meta: {
          keepAlive: true,
          title: '操作日志',
          // notCache: false,
          icon: ''
        },
        component: () => import('@/view/home/logger.vue')
      }
    ]
  },
  {
    path: '/',
    name: '_home',
    redirect: '/home',
    component: Main,
    meta: {
      keepAlive: true,
      title: '工作台',
      access: ['_home']
    },
    children: [
      {
        path: '/home',
        name: 'home',
        meta: {
          keepAlive: true,
          title: '首页',
          access: ['_home'],
          icon: '_gongzuotai'
        },
        component: () => import('@/view/home/home.vue')
      }
    ]
  },
  {
    path: '/data-screening',
    name: 'data-screening',
    meta: {
      hideInMenu: true
    },
    component: () => import('@/view/data-screening/index.vue')
  },
  {
    path: '/data-screening-once',
    name: 'data-screening-once',
    meta: {
      hideInMenu: true
    },
    component: () => import('@/view/data-screening/index-once.vue')
  },
  {
    path: '/401',
    name: 'error_401',
    meta: {
      keepAlive: true,
      hideInMenu: true
    },
    component: () => import('@/view/error-page/401.vue')
  },
  {
    path: '/500',
    name: 'error_500',
    meta: {
      keepAlive: true,
      hideInMenu: true
    },
    component: () => import('@/view/error-page/500.vue')
  },
  {
    path: '*',
    name: 'error_404',
    meta: {
      keepAlive: true,
      hideInMenu: true
    },
    component: () => import('@/view/error-page/404.vue')
  },
  {
    path: '/clientInfo',
    name: 'clientInfo',
    component: Main,
    meta: {
      keepAlive: true,
      hideInMenu: false,
      title: '公司信息',
      access: ['customerInformation'],
      icon: '_yitihualinghuoyonggong'
    },
    children: [
      {
        path: 'clientInfoList',
        name: 'clientInfoList',
        meta: {
          keepAlive: true,
          hideInMenu: false,
          title: '公司信息',
          access: ['customerInformation'],
          icon: '_yitihualinghuoyonggong',
          requiresAuth: true
        },
        component: () => import('@/view/business-sector/customerManage/CustomerInformation/CustomerInformationDetail.vue')
      }
    ]
  },
  mailManageRouter, // 邮件管理
  // businessSectorRouter, // 雇员管理
  {
    path: '/business-sector',
    name: 'business-sector',
    meta: {
      keepAlive: true,
      icon: '_HRDCkehuxiaoshouzhongxin',
      showAlways: true,
      access: ['rosterManage', 'business-sector', 'EmployeeQuickEntry', 'roster'],
      title: '雇员管理'
    },
    component: Main,
    children: [
      {
        path: 'waitInduction',
        name: 'waitInduction',
        meta: {
          keepAlive: false,
          title: '待入职员工',
          access: ['EmployeeQuickEntry'],
          notCache: true
        },
        component: () => import('@/view/business-sector/waitInduction/waitInduction.vue')
      },
      // {
      //   path: 'EmployeeCreate2',
      //   name: 'EmployeeCreate2',
      //   meta: {
      //     keepAlive: false,
      //     title: '待入职员工员工详情',
      //     hideInMenu: true,
      //     access: ['EmployeeQuickEntry'],
      //     notCache: true
      //   },
      //   component: () => import('@/view/business-sector/customerManage/EmployeeBook/EmployeeCreate.vue')
      // },
      {
        path: 'roster',
        name: 'roster',
        meta: {
          keepAlive: true,
          title: '员工花名册',
          access: ['roster'],
          notCache: false
        },
        component: () => import('@/view/business-sector/rosterManage/roster/rosterList.vue')
      },      
      {
        path: 'EmployeeCreate',
        name: 'EmployeeCreate',
        meta: {
          keepAlive: false,
          title: '员工详情',
          hideInMenu: true,
          access: ['roster'],
          notCache: true
        },
        component: () => import('@/view/business-sector/customerManage/EmployeeBook/EmployeeCreate.vue')
      },
      {
        path: 'InsuranceInfoSet',
        name: 'InsuranceInfoSet',
        meta: {
          keepAlive: false,
          title: '参保信息设置',
          hideInMenu: true,
          notCache: true
        },
        component: () => import('@/view/business-sector/customerManage/EmployeeBook/InsuranceInfoSet.vue')
      },
      {
        path: 'socialProvidentBasicData',
        name: 'socialProvidentBasicData',
        meta: {
          keepAlive: false,
          title: '社保公积金基数管理',
          access: ['EmployeeInsured'],
          notCache: true
        },
        component: () => import('@/view/business-sector/rosterManage/basicData/socialProvidentBasicData.vue')
      },
      {
        path: 'commercialBasicData',
        name: 'commercialBasicData',
        meta: {
          keepAlive: false,
          title: '商保基数管理',
          access: ['EmployeeInsuredCommercial'],
          notCache: true
        },
        component: () => import('@/view/business-sector/rosterManage/basicData/commercialBasicData.vue')
      },
    ]
  },
  {
    path: '/changesVerify',
    name: 'changesVerify',
    meta: {
      keepAlive: true,
      icon: '_HRDCkehujiaofuzhongxin',
      access: ['changesVerify', 'ssChangesVerifyManage', 'afChangesVerifyManage', 'ciChangesVerifyManage'],
      title: '增减员管理'
    },
    component: Main,
    children: [
      {
        path: 'ssChangesVerifyManage',
        name: 'ssChangesVerifyManage',
        meta: {
          keepAlive: true,
          title: '社保增减员',
          access: ['ssChangesVerifyManage']
          // notCache: true
        },
        component: () => import('@/view/business-sector/changesManage/SsChangesManage/SsChangesManage.vue')
      },
      {
        path: 'afChangesVerifyManage',
        name: 'afChangesVerifyManage',
        meta: {
          keepAlive: true,
          title: '公积金增减员',
          access: ['afChangesVerifyManage']
          // notCache: true
        },
        component: () => import('@/view/business-sector/changesManage/AfChangesManage/AfChangesManage.vue')
      },
      {
        path: 'ciChangesVerifyManage',
        name: 'ciChangesVerifyManage',
        meta: {
          keepAlive: true,
          title: '商保增减员',
          access: ['ciChangesVerifyManage']
          // notCache: true
        },
        component: () => import('@/view/business-sector/changesManage/CIChangesVerifyManage.vue')
      }
    ]
  },
  {
    path: '/treatmentManage',
    name: 'treatmentManage',
    meta: {
      keepAlive: true,
      icon: '_caiwubankuai',
      access: ['TreatmentManage', 'TreatmentEnjoyManage', 'CAFundTreatmentEnjoyManage', 'CITreatmentEnjoyManage'],
      title: '待遇管理',
      showAlways: true
    },
    component: Main,
    children: [
      {
        path: 'socialWagesManage',
        name: 'socialWagesManage',
        meta: {
          keepAlive: false,
          title: '社保待遇管理',
          access: ['TreatmentEnjoyManage'],
          // notCache: true
        },
        component: () => import('@/view/business-sector/socialWagesManage/socialWagesManage.vue')
      },
      {
        path: 'editSocialNode',
        name: 'editSocialNode',
        meta: {
          title: '查看环节',
          hideInMenu: true,
          notCache: true,
          access: ['TreatmentEnjoyManage']
        },
        component: () => import('@/view/business-sector/socialWagesManage/editNode.vue')
      },
      {
        path: 'fundWagesManage',
        name: 'fundWagesManage',
        meta: {
          keepAlive: false,
          title: '公积金待遇管理',
          access: ['CAFundTreatmentEnjoyManage'],
          notCache: true
        },
        component: () => import('@/view/business-sector/fundWagesManage/fundWagesManage.vue')
      },
      {
        path: 'editFundNode',
        name: 'editFundNode',
        meta: {
          title: '查看公积金环节',
          hideInMenu: true,
          notCache: true,
          access: ['CAFundTreatmentEnjoyManage']
        },
        component: () => import('@/view/business-sector/fundWagesManage/editNode.vue')
      },
      {
        path: 'commercialWagesManage',
        name: 'commercialWagesManage',
        meta: {
          keepAlive: false,
          title: '商保待遇管理',
          access: ['CITreatmentEnjoyManage'],
          notCache: true
        },
        component: () => import('@/view/business-sector/commercialWagesManage/commercialWagesManage.vue')
      },
      {
        path: 'editCommercialNode',
        name: 'editCommercialNode',
        meta: {
          title: '查看商保环节',
          hideInMenu: true,
          notCache: true,
          access: ['CITreatmentEnjoyManage']
        },
        component: () => import('@/view/business-sector/commercialWagesManage/editNode.vue')
      },
    ]
  },
  {
    path: '/CustomerSalary',
    name: 'CustomerSalary',
    meta: {
      keepAlive: true,
      access: ['CusSalary', 'CustomerSalary'],
      title: '薪资管理',
    },
    component: Main,
    children: [
      {
        path: 'CustomerSalaryList',
        name: 'CustomerSalaryList',
        meta: {
          keepAlive: false,
          icon: '_baobiaoguanli',
          title: '薪资管理',
          access: ['CustomerSalary']
          // notCache: false
        },
        component: () => import('@/view/business-sector/customerManage/CustomerSalary/CustomerSalary.vue')
      },
      {
        path: 'CustomerSalaryDetail',
        name: 'CustomerSalaryDetail',
        meta: {
          keepAlive: false,
          hideInMenu: true,
          title: '客户薪资明细',
          access: ['CustomerSalary'],
          notCache: true
        },
        component: () => import('@/view/business-sector/customerManage/CustomerSalary/CustomerSalaryDetail.vue')
      },
    ]
  },
  {
    path: '/CustomerBill',
    name: 'CustomerBill',
    meta: {
      keepAlive: true,
      access: ['CustomerBill'],
      title: '账单管理',
    },
    component: Main,
    children: [
      {
        path: 'CustomerBillList',
        name: 'CustomerBillList',
        meta: {
          keepAlive: false,
          icon: '_shangwuhetongguanli',
          title: '账单管理',
          access: ['CustomerBill'],
          notCache: true
        },
        component: () => import('@/view/business-sector/customerManage/CustomerBill/CustomerBill.vue')
      },
      {
        path: 'CustomerBillDetail',
        name: 'CustomerBillDetail',
        meta: {
          keepAlive: false,
          hideInMenu: true,
          title: '客户账单明细',
          access: ['CustomerBill'],
          notCache: true
        },
        component: () => import('@/view/business-sector/customerManage/CustomerBill/CustomerBillDetail.vue')
      },
    ]
  },
  {
    path: '/invoiceManage',
    name: 'invoiceManage',
    meta: {
      keepAlive: true,
      access: ['FinanceInvoiceApply'],
      title: '发票管理',
    },
    component: Main,
    children: [
      {
        path: 'invoiceApply',
        name: 'invoiceApply',
        meta: {
          keepAlive: false,
          icon: '_gongzuotai',
          title: '发票管理',
          access: ['FinanceInvoiceApply'],
          notCache: true
        },
        component: () => import('@/view/finance/invoiceManage/invoiceApply/invoiceApply.vue')
      },
    ]
  }
]
